$(document).ready(function(){
	$("#submitButton").click(function(){
		$.ajaxFileUpload({
			url:'modelupload',
			secureuri:false,
			fileElementId:"uploadModelInput",
			dataType: 'json',
			success:function(data, status){
				try{
					$("#modelIdInput").val(data.successMessage);
					$("#modelFileNameInput").val(data.bindKey);
				}catch(ex){
					alert(ex);
				}
				$.post("pitch/edit", {
					companyTicker:$("#companyTicker").val(),
					companyName:$("#companyName").val(),
					currentPrice:$("#currentPrice").val(),
					targetPrice:$("#targetPrice").val(),
					assetClass:$("#assetClass").val(),
					geography:$("#geography").val(),
					recommendation:$("#recommendation").val(),
					country:$("#country").val(),
					expectedTimeframe:$("#expectedTimeframe").val(),
					situation:$("#situation").val(),
					sector:$("#sector").val(),
					ideaAvailability:$("#ideaAvailability").val(),
					thesis:$("#thesis").val(),
					variantView:$("#variantView").val(),
					modelId:$("#modelIdInput").val(),
					modelType:$("#modelType").val(),
					modelFileName:$("#modelFileNameInput").val(),
					description:$("#description").val()
				}, function(data){
					if(data.success){
						window.location.href="studentHome";
					}else{
						alert(data.errorMessage);
					}
				}, "json");
			}
		});
	});
});